class Solution {
    public int maxArea(int[] height) {
        int left = 0;
        int rigth = height.length - 1;
        int max = 0;
        while(left < rigth){
            max = height[left] < height[rigth] ? 
            Math.max(max,(rigth-left)*height[left++]):
            Math.max(max,(rigth-left)*height[rigth--]);
        }
        return max;
    }
}